Skip to main content

Class: StreamMessage<T>

Type parameters​

NameType
Tunknown

Constructors​

constructor​

β€’ new StreamMessage<T>(Β«destructuredΒ»)

Type parameters​

NameType
Tunknown

Parameters​

NameType
Β«destructuredΒ»StreamMessageOptions<T>

Properties​

contentType​

β€’ contentType: JSON


encryptionType​

β€’ encryptionType: EncryptionType


groupKeyId​

β€’ groupKeyId: null | string


messageId​

β€’ messageId: MessageID


messageType​

β€’ messageType: StreamMessageType


newGroupKey​

β€’ newGroupKey: null | EncryptedGroupKey


parsedContent​

β€’ Optional parsedContent: T


prevMsgRef​

β€’ prevMsgRef: null | MessageRef


serializedContent​

β€’ serializedContent: string


signature​

β€’ signature: string


LATEST_VERSION​

β–ͺ Static LATEST_VERSION: number

Methods​

clone​

β–Έ clone(): StreamMessage<T>

Create a new StreamMessage identical to the passed-in streamMessage.

Returns​

StreamMessage<T>


getContent​

β–Έ getContent(): string

Returns​

string

β–Έ getContent(parsedContent): string

Parameters​

NameType
parsedContentfalse

Returns​

string

β–Έ getContent(parsedContent): T

Parameters​

NameType
parsedContenttrue

Returns​

T


getMessageID​

β–Έ getMessageID(): MessageID

Returns​

MessageID


getMessageRef​

β–Έ getMessageRef(): MessageRef

Returns​

MessageRef


getMsgChainId​

β–Έ getMsgChainId(): string

Returns​

string


getNewGroupKey​

β–Έ getNewGroupKey(): null | EncryptedGroupKey

Returns​

null | EncryptedGroupKey


getParsedContent​

β–Έ getParsedContent(): T

Lazily parses the content to JSON

Returns​

T


getPreviousMessageRef​

β–Έ getPreviousMessageRef(): null | MessageRef

Returns​

null | MessageRef


getPublisherId​

β–Έ getPublisherId(): [EthereumAddress](../API Reference#ethereumaddress)

Returns​

[EthereumAddress](../API Reference#ethereumaddress)


getSequenceNumber​

β–Έ getSequenceNumber(): number

Returns​

number


getSerializedContent​

β–Έ getSerializedContent(): string

Returns​

string


getStreamId​

β–Έ getStreamId(): [StreamID](../API Reference#streamid)

Returns​

[StreamID](../API Reference#streamid)


getStreamPartID​

β–Έ getStreamPartID(): [StreamPartID](../API Reference#streampartid)

Returns​

[StreamPartID](../API Reference#streampartid)


getStreamPartition​

β–Έ getStreamPartition(): number

Returns​

number


getTimestamp​

β–Έ getTimestamp(): number

Returns​

number


serialize​

β–Έ serialize(version?): string

Parameters​

NameType
version?number

Returns​

string


deserialize​

β–Έ Static deserialize(msg): StreamMessage<unknown>

Takes a serialized representation (array or string) of a message, and returns a StreamMessage instance.

Parameters​

NameType
msgstring | any[]

Returns​

StreamMessage<unknown>


getSupportedVersions​

β–Έ Static getSupportedVersions(): number[]

Returns​

number[]


isEncrypted​

β–Έ Static isEncrypted<T>(msg): msg is StreamMessageEncrypted<T>

Type parameters​

NameType
Tunknown

Parameters​

NameType
msgStreamMessage<T>

Returns​

msg is StreamMessageEncrypted<T>


isUnencrypted​

β–Έ Static isUnencrypted<T>(msg): msg is StreamMessageUnencrypted<T>

Type parameters​

NameType
Tunknown

Parameters​

NameType
msgStreamMessage<T>

Returns​

msg is StreamMessageUnencrypted<T>


validateContentType​

β–Έ Static validateContentType(contentType): void

Parameters​

NameType
contentTypeJSON

Returns​

void


validateEncryptionType​

β–Έ Static validateEncryptionType(encryptionType): void

Parameters​

NameType
encryptionTypeEncryptionType

Returns​

void


validateMessageType​

β–Έ Static validateMessageType(messageType): void

Parameters​

NameType
messageTypeStreamMessageType

Returns​

void


validateSequence​

β–Έ Static validateSequence(Β«destructuredΒ»): void

Parameters​

NameType
Β«destructuredΒ»Object
β€ΊΒ messageIdMessageID
β€ΊΒ prevMsgRef?null | MessageRef

Returns​

void


versionSupportsEncryption​

β–Έ Static versionSupportsEncryption(streamMessageVersion): boolean

Parameters​

NameType
streamMessageVersionnumber

Returns​

boolean